﻿*Please note: after downloading SPSS version of ANES file, if necessary we hand coded what variable values counted as missing values in the Variable View tabl Missing column.

*Recode demographic and political variables.
RECODE VCF0105a (1=0) (2=1) (3 thru 6=0) (ELSE=SYSMIS) INTO Black.
VARIABLE LABELS  Black 'Black (white is contrast)'.
EXECUTE.
RECODE VCF0105a (1 thru 2 =0) (3=1) (4 thru 6=0) (ELSE=SYSMIS) INTO Asian.
VARIABLE LABELS  Asian 'Asian or Pacific Islander'.
EXECUTE.
RECODE VCF0105a (1 thru 3 =0) (4=1) (5 thru 6=0) (ELSE=SYSMIS) INTO AmericanIndian.
VARIABLE LABELS  AmericanIndian 'American Indian'.
EXECUTE.
RECODE VCF0105a (1 thru 4 =0) (5=1) (6=0) (ELSE=SYSMIS) INTO Hispanic.
VARIABLE LABELS  Hispanic 'Hispanic'.
EXECUTE.
RECODE VCF0105a (1 thru 5 =0) (6=1) (ELSE=SYSMIS) INTO OtherMultiple.
VARIABLE LABELS  OtherMultiple 'Other or Multiple Races'.
EXECUTE.
COMPUTE Income0to1=(VCF0114-1)/4.
EXECUTE.
COMPUTE AgeDivBy100=(VCF0101)/100.
EXECUTE.
RECODE VCF0104 (1=1) (2=0) (ELSE=SYSMIS) INTO GenderF0M1.
EXECUTE.
COMPUTE Education0to1=(VCF0110-1)/3.
EXECUTE.
COMPUTE Conservatism0to1=(VCF0803-1)/6.
EXECUTE.
RECODE VCF0301 (5 thru 7=1) (1 thru 3=0) (ELSE=SYSMIS) INTO PartyIDCollapsedFrom7point.
EXECUTE.

*Recode independent and dependent variables.
COMPUTE InfluenceOthersN0Y1=VCF0717-1.
EXECUTE.
COMPUTE DemocratCandidateAngryN0Y1=1-(VCF0358-1).
EXECUTE.
COMPUTE DemocratCandidateProudN0Y1=1-(VCF0361-1).
EXECUTE.
COMPUTE RepublicanCandidateAngryN0Y1=1-(VCF0370-1).
EXECUTE.
COMPUTE RepublicanCandidateProudN0Y1=1-(VCF0373-1).
EXECUTE.

*Has complete data.
COMPUTE DataOnAllVariables=DemocratCandidateAngryN0Y1+DemocratCandidateProudN0Y1+
    RepublicanCandidateAngryN0Y1+RepublicanCandidateProudN0Y1+Income0to1+AgeDivBy100+GenderF0M1+Black+
    Asian+AmericanIndian+Hispanic+OtherMultiple+Education0to1+Conservatism0to1+InfluenceOthersN0Y1.
EXECUTE.

*Analyzing only people from 2012, with complete data, who are Democrats or Republicans or leaners.
USE ALL. 
COMPUTE filter_$=(VCF0004=2012 & HasDataOnAllVariables=1 & (PartyIDCollapsedFrom7point=0|PartyIDCollapsedFrom7point=1)). 
VARIABLE LABELS filter_$ 'VCF0004=2012 & '+ 
    '(PartyIDCollapsedFrom7point=0|PartyIDCollapsedFrom7point=1) (FILTER)'. 
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. 
FORMATS filter_$ (f1.0). 
FILTER BY filter_$. 
EXECUTE. 

*Demographic stats.
EXAMINE VARIABLES=VCF0101 VCF0104 VCF0110 VCF0114 VCF0105a VCF0803 PartyIDCollapsedFrom7point 
  /PLOT BOXPLOT STEMLEAF 
  /COMPARE GROUPS 
  /STATISTICS DESCRIPTIVES 
  /CINTERVAL 95 
  /MISSING LISTWISE 
  /NOTOTAL.
FREQUENCIES VARIABLES=VCF0105a 
  /ORDER=ANALYSIS.
FREQUENCIES VARIABLES=VCF0110 
  /ORDER=ANALYSIS.
FREQUENCIES VARIABLES=VCF0114 
  /ORDER=ANALYSIS.
FREQUENCIES VARIABLES=PartyIDCollapsedFrom7point 
  /ORDER=ANALYSIS.

*Analyze Democrats and Republicans Separately.
SORT CASES  BY PartyIDCollapsedFrom7point. 
SPLIT FILE LAYERED BY PartyIDCollapsedFrom7point.

*Regression for Anger.
LOGISTIC REGRESSION VARIABLES InfluenceOthersN0Y1 
  /METHOD=ENTER DemocratCandidateAngryN0Y1 RepublicanCandidateAngryN0Y1 Income0to1 GenderF0M1 AgeDivBy100 Black Asian 
    AmericanIndian Hispanic OtherMultiple Education0to1 Conservatism0to1 
  /CRITERIA=PIN(.05) POUT(.10) ITERATE(20) CUT(.5).

*Regression for Pride.
LOGISTIC REGRESSION VARIABLES InfluenceOthersN0Y1 
  /METHOD=ENTER DemocratCandidateProudN0Y1 RepublicanCandidateProudN0Y1 Income0to1 GenderF0M1 AgeDivBy100 Black Asian 
    AmericanIndian Hispanic OtherMultiple Education0to1 Conservatism0to1 
  /CRITERIA=PIN(.05) POUT(.10) ITERATE(20) CUT(.5).


